/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package mywork04;

import javax.swing.JOptionPane;

/**
 *
 * @author sara
 */
public class conversion {
    static void conver(int n,int radix)
    {
        String result;
        if(radix==2)
        {
            result=Integer.toBinaryString(n);
            JOptionPane.showMessageDialog(null,"Binary:"+result+"\n","conversion",JOptionPane.PLAIN_MESSAGE);
        }
        else if(radix==8)
        {
            result=Integer.toOctalString(n);
            JOptionPane.showMessageDialog(null,"Octal:"+result+"\n","conversion",JOptionPane.PLAIN_MESSAGE);
        }       
        else
        {
            result=Integer.toHexString(n);
            JOptionPane.showMessageDialog(null,"Hex :"+result+"\n","conversion",JOptionPane.PLAIN_MESSAGE);
        }
        

    }
}
